package org.noob.codewars.train.mid_level.prac160302;

/**
 * Many people choose to obfuscate their email address when displaying it on the
 * Web. One common way of doing this is by substituting the @ and . characters
 * for their literal equivalents in brackets.
 * 
 * Example 1:
 * 
 * user_name@example.com => user_name [at] example [dot] com Example 2:
 * 
 * af5134@borchmore.edu => af5134 [at] borchmore [dot] edu Example 3:
 * 
 * jim.kuback@ennerman-hatano.com => jim [dot] kuback [at] ennerman-hatano [dot]
 * com Using the examples above as a guide, write a function that takes an email
 * address string and returns the obfuscated version as a string that replaces
 * the characters @ and . with [at] and [dot], respectively.
 * 
 * Notes
 * 
 * Input (email) will always be a string object. Your function should return a
 * string. Change only the @ and . characters. Email addresses may contain more
 * than one . character. Note the additional whitespace around the bracketed
 * literals in the examples!
 * 
 * @author Administrator
 *
 */
public class EmailObfuscator {

	public static void main(String[] args) {
		String email = "test.aa@189.com";
		obfuscate(email);
	}

	public static String obfuscate(String email) {
		System.out.println(email);
		email = email.replace(".", " [dot] ");
		System.out.println(email);
		email = email.replace("@", " [at] ");
		System.out.println(email);

		return "";
	}

	/**
	 * best practices
	 * @param email
	 * @return
	 */
	public static String obfuscate1(String email) {

		return email.replace("@", " [at] ").replace(".", " [dot] ");
	}

}
